package cn.kent.builderPattern;

import java.util.ArrayList;

/**
 * 做了一层封装
 *
 * @author kent
 * @date 2021/6/1 16:26
 */
public class Director {
    private ArrayList<String> sequence = new ArrayList<>();
    private BenzBuilder benzBuilder = new BenzBuilder();

    private BMWBuilder bmwBuilder = new BMWBuilder();

    /**
     * A类型的奔驰车模型，start-stop-over
     */
    public BenzModel getABenzModel(){
        // 清理场景
        this.sequence.clear();

        // 这只是A类型奔驰车的执行顺序
        this.sequence.add("start");
        this.sequence.add("stop");

        this.benzBuilder.setSequence(this.sequence);
        return (BenzModel) this.benzBuilder.getCarModel();
    }

    /**
     * D型宝马
     * @return
     */
    public BMWModel getDBMWModel(){
        this.sequence.clear();
        this.sequence.add("start");
        this.bmwBuilder.setSequence(this.sequence);
        return (BMWModel) this.bmwBuilder.getCarModel();
    }

}
